package com.example.demo.controller.experycontroller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.Result;
import com.example.demo.context.UserContext;
import com.example.demo.entity.Expert;
import com.example.demo.service.ExpertService;
import com.example.demo.vo.UserLoginVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/expert")
@RequiredArgsConstructor
public class ExperyController {
    private final ExpertService expertService;

    @GetMapping("info")
    public Result<Expert> getuserinfo() {
        Expert id = expertService.getOne(new QueryWrapper<Expert>().eq("id", UserContext.getUserId()));
        return Result.success(id);
    }

    @PutMapping("/status")
    public Result<Void> updateStatus(@RequestParam("status") Integer status) {
        expertService.updateStatus(status);
        return Result.success();
    }
}
